package com.example.prison.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Data
public class SocketResponse<T> {
    private String status;
    private String message;
    private Integer flag;
    private T data;

    public SocketResponse(String status, String message, Integer flag) {
        this.status = status;
        this.message = message;
        this.flag = flag;
    }

    public SocketResponse(String status, String message, Integer flag, T data) {
        this.status = status;
        this.message = message;
        this.flag = flag;
        this.data = data;
    }

    public SocketResponse() {
    }

    public static <T> SocketResponse<T> success(String message,  Integer flag) {
        return new SocketResponse<>("success", message, flag);
    }

    public static <T> SocketResponse<T> error(String message) {
        return new SocketResponse<>("error", message, 0);
    }

    public static <T> SocketResponse<T> success(String message,  Integer flag, T data) {
        return new SocketResponse<>("success", message, flag, data);
    }

    public static <T> SocketResponse<T> error(String message, T data) {
        return new SocketResponse<>("error", message, 0,  data);
    }
}
